-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added nsxt_license Resource #423
Conversation
website/docs/r/license.html.markdown
Outdated
|
||
The following arguments are supported: | ||
|
||
* `license_key` - (Required) NSX-T license key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Coleman, looks good, just one nit - if import is supported, it should be mentioned here in the docs.
I also think that resources that are dependent on this license will fail to create/delete together with the licence, unless an explicit depends_on is specified in resource config. I don't think we can fix this easily, but worth mentioning this here in the doc.
nsxt/resource_nsxt_license.go
Outdated
return &schema.Resource{ | ||
Create: resourceNsxtLicenseCreate, | ||
Read: resourceNsxtLicenseRead, | ||
Update: resourceNsxtLicenseCreate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove the Update here and thus forbid the update
nsxt/utils_test.go
Outdated
@@ -112,6 +112,10 @@ func getTestCertificateName(isClient bool) string { | |||
return os.Getenv("NSXT_TEST_CERTIFICATE_NAME") | |||
} | |||
|
|||
func getTestLicenseKey() string { | |||
return os.Getenv("NSXT_LICENSE_KEY") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets call it NSXT_TEST_LICENSE_KEY to align with other test env settings. Thanks!
CHANGELOG.md
Outdated
@@ -1,4 +1,8 @@ | |||
## 2.2.0 (Unreleased) | |||
|
|||
FEATURES: | |||
* **New Resource**: `nsxt_license` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not accurate any more
nsxt/provider.go
Outdated
} | ||
|
||
func configureLicenses(d *schema.ResourceData, clients *nsxtClients) error { | ||
for _, lic_key := range d.Get("license_keys").([]interface{}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we only do this is d.HasChange("license_keys").
Also shouldn't we handle license removal as well?
d.GetChange can help determine which ones were added and which ones removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems as if provider attributes are not persisted, and d.HasChange returns true even when there has not been a change in configuration. d.GetChange always produces an empty list and the current list instead of the previous configuration in this case. It may make sense for License to be a resource if removal is necessary. Should we keep license in the provider and not handle removal, or make it a resource and document the need for explicit depends_on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.. Removing a license is probably a rare use case.. I'm ok with leaving this as is (it would be nice to leave a comment about this in the code and in docs).
Added a resource to allow terraform users to apply an NSX-T license.
Added license_keys argument to the provider block to allow users to add nsx-t license keys there.
Added docs that explain the lack of license key delete process.
Hi Coleman, sorry to ask for yet another change on this.. |
This change prevents vmc token from being used with license.
Added a resource to allow terraform users to apply an NSX-T license.